package com.feng.study.controller;

import com.feng.study.dao.UserDao;
import com.feng.study.entity.UserEntity;
import com.feng.study.service.localhost.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list/user")
    public List<UserEntity> listUser(){
        String name="hello";
        List<UserEntity> userEntities = userService.listUser(name);
        System.out.println(userEntities);

        System.out.println("userService:::"+userService.getClass());
        userService.testTransactionTemplate();
        return userEntities;
    }

    @GetMapping("/save")
    public void saveUser(){
        userService.saveList();
    }
}
